#[derive(Debug, thiserror::Error)]
pub enum P2pNetWorkError {
    #[error("Swarm dial error: {0}")]
    SwarmDialError(#[from] libp2p::swarm::DialError),

    #[error("libp2p transport error: {0}")]
    SwarmTransportError(#[from] libp2p::TransportError<std::io::Error>),

    #[error("Request-response outbound failure: {0}")]
    OutboundFailure(#[from] libp2p::request_response::OutboundFailure),

    #[error("gossipsub failed to publish message: {0}")]
    PublishError(#[from] libp2p::gossipsub::PublishError),

    #[error("Subscription error: {0}")]
    SubscriptionError(#[from] libp2p::gossipsub::SubscriptionError),

    #[error("Noise handshake error: {0}")]
    NoiseHandshakeError(#[from] libp2p::noise::Error),

    #[error("Behaviour builder error: {0}")]
    BehaviourBuilderError(#[from] libp2p::BehaviourBuilderError),

    #[error("Multiaddr parse error: {0}")]
    MultiaddrParseError(#[from] libp2p::multiaddr::Error),
}

pub(super) mod network_core_impl;
pub(crate) mod network_core_inner_api;
